home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 April / Gamestar_61_2004-04_dvdb.iso / DVDStar / Editace / hltp.exe / {app} / Source Code / Half-Life Model Viewer / src / ViewerSettings.cpp < prev    next >
C/C++ Source or Header  |  1999-05-29  |  2KB  |  83 lines

  1. //
  2. //                 Half-Life Model Viewer (c) 1999 by Mete Ciragan
  3. //
  4. // file:           ViewerSettings.cpp
  5. // last modified:  May 29 1999, Mete Ciragan
  6. // copyright:      The programs and associated files contained in this
  7. //                 distribution were developed by Mete Ciragan. The programs
  8. //                 are not in the public domain, but they are freely
  9. //                 distributable without licensing fees. These programs are
  10. //                 provided without guarantee or warrantee expressed or
  11. //                 implied.
  12. //
  13. // version:        1.2
  14. //
  15. // email:          mete@swissquake.ch
  16. // web:            http://www.swissquake.ch/chumbalum-soft/
  17. //
  18. #include "ViewerSettings.h"
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22.  
  23.  
  24.  
  25. ViewerSettings g_viewerSettings;
  26.  
  27.  
  28.  
  29. void
  30. InitViewerSettings (void)
  31. {
  32.     memset (&g_viewerSettings, 0, sizeof (ViewerSettings));
  33.     g_viewerSettings.rot[0] = -90.0f;
  34.     g_viewerSettings.trans[3] = 50.0f;
  35.     g_viewerSettings.renderMode = RM_TEXTURED;
  36.     g_viewerSettings.transparency = 1.0f;
  37.  
  38.     g_viewerSettings.gColor[0] = 0.85f;
  39.     g_viewerSettings.gColor[1] = 0.85f;
  40.     g_viewerSettings.gColor[2] = 0.69f;
  41.  
  42.     g_viewerSettings.lColor[0] = 1.0f;
  43.     g_viewerSettings.lColor[1] = 1.0f;
  44.     g_viewerSettings.lColor[2] = 1.0f;
  45.  
  46.     g_viewerSettings.speedScale = 1.0f;
  47.     g_viewerSettings.textureLimit = 256;
  48.  
  49.     g_viewerSettings.textureScale = 1.0f;
  50. }
  51.  
  52.  
  53.  
  54. int
  55. LoadViewerSettings (const char *filename)
  56. {
  57.     FILE *file = fopen (filename, "rb");
  58.  
  59.     if (!file)
  60.         return 0;
  61.  
  62.     fread (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
  63.     fclose (file);
  64.  
  65.     return 1;
  66. }
  67.  
  68.  
  69.  
  70. int
  71. SaveViewerSettings (const char *filename)
  72. {
  73.     FILE *file = fopen (filename, "wb");
  74.  
  75.     if (!file)
  76.         return 0;
  77.  
  78.     fwrite (&g_viewerSettings, sizeof (ViewerSettings), 1, file);
  79.     fclose (file);
  80.  
  81.     return 1;
  82. }
  83.